package com.yhstudio.designPattern.iterator;

public class Test {
    public static void main(String[] args) {
        BookShelf bookShelf = new BookShelf();
        bookShelf.appendBook(new Book("《三国演义》"));
        bookShelf.appendBook(new Book("《西游记》"));
        bookShelf.appendBook(new Book("《水浒传》"));
        bookShelf.appendBook(new Book("《红楼梦》"));
        Iterator iterator = bookShelf.createIterator();
        while (iterator.hasNext()) {
            Book book = (Book) iterator.next();
            System.out.println(book.getBookName());
        }
    }
}
